package com.ttbj.product.bean.dto;

import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.NotNull;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.ttbj.constant.GenerateNumConstants;
import com.ttbj.util.DateUtils;
import com.ttbj.util.TokenUtils;

@JsonInclude(Include.NON_NULL)
public class OrderDto implements Serializable {

	private static final long serialVersionUID = -5325742284577958348L;

	private Long orderId;

	private String orderNum;

	private String orderNotes;

	@NotNull(message = "寄件人资料不能缺失")
	private Long orderSender;

	@NotNull(message = "收件人资料不能缺失")
	private Long orderReciver;

	private Integer orderRestate;

	private Integer orderState;

	private Integer orderPayState;

	private Long orderWxUser;

	private String orderInsDate;

	private String orderUpdateDate;

	private Long orderQuit;

	private Integer orderToCarry;

	private Integer orderToPack;

	private Integer orderFloorNum;

	private Integer orderBoxNum;

	private Integer orderIsMove;

	private Integer orderToInvoice;

	private String orderPayTime;

	private Integer orderPayWay;

	private Float orderAllPay;

	private Float orderPackPay;

	private Float orderCod;

	private Float orderMovePay;

	private Integer orderIsDelete;

	private Long orderDriver;

	private Long orderTruck;

	private String orderTruckType;

	private OwnerDto reciver;

	private OwnerDto sender;

	private String openId;

	private List<DriverDto> drivers;

	private List<TruckDto> trucks;
	
	private CargoDto cargoDto; 
	
	private Long orderCargo;
	
    private String orderRealnameComment;
    
    private String orderComment;

    private Integer orderLevel;
    
    private Integer orderDriverRequire;

    private Integer orderDriverAlready;

    private Integer orderUrgent;
    
    private String orderPrearrangeTime;

    private Long orderDiscount;
    
    private Float orderCarriage;

    private Float orderDistance;
    
    private Integer several;
    
    /**
     * 1自动处理，0手动处理
     */
    private Integer orderAutoComple; 
    
	public Integer getOrderAutoComple() {
		return orderAutoComple;
	}

	public void setOrderAutoComple(Integer orderAutoComple) {
		this.orderAutoComple = orderAutoComple;
	}

	public Integer getSeveral() {
		return null == several ? 0 : several;
	}

	public void setSeveral(Integer several) {
		this.several = several;
	}

	public Float getOrderCarriage() {
		return orderCarriage;
	}

	public void setOrderCarriage(Float orderCarriage) {
		this.orderCarriage = orderCarriage;
	}

	public Float getOrderDistance() {
		return orderDistance;
	}

	public void setOrderDistance(Float orderDistance) {
		this.orderDistance = orderDistance;
	}

	public String getOrderPrearrangeTime() {
		return orderPrearrangeTime;
	}

	public void setOrderPrearrangeTime(String orderPrearrangeTime) {
		this.orderPrearrangeTime = orderPrearrangeTime;
	}

	public Long getOrderDiscount() {
		return orderDiscount;
	}

	public void setOrderDiscount(Long orderDiscount) {
		this.orderDiscount = orderDiscount;
	}

	public Integer getOrderDriverRequire() {
		return null == orderDriverRequire ? 1 : orderDriverRequire;
	}

	public void setOrderDriverRequire(Integer orderDriverRequire) {
		this.orderDriverRequire = orderDriverRequire;
	}

	public Integer getOrderDriverAlready() {
		return orderDriverAlready;
	}

	public void setOrderDriverAlready(Integer orderDriverAlready) {
		this.orderDriverAlready = orderDriverAlready;
	}

	public Integer getOrderUrgent() {
		return orderUrgent;
	}

	public void setOrderUrgent(Integer orderUrgent) {
		this.orderUrgent = orderUrgent;
	}

	public String getOrderComment() {
		return orderComment;
	}

	public void setOrderComment(String orderComment) {
		this.orderComment = orderComment;
	}

	public Integer getOrderLevel() {
		return orderLevel;
	}

	public void setOrderLevel(Integer orderLevel) {
		this.orderLevel = orderLevel;
	}

	public String getOrderRealnameComment() {
		return orderRealnameComment;
	}

	public void setOrderRealnameComment(String orderRealnameComment) {
		this.orderRealnameComment = orderRealnameComment;
	}

	public CargoDto getCargoDto() {
		return cargoDto;
	}

	public void setCargoDto(CargoDto cargoDto) {
		this.cargoDto = cargoDto;
	}

	public Long getOrderCargo() {
		return orderCargo;
	}

	public void setOrderCargo(Long orderCargo) {
		this.orderCargo = orderCargo;
	}

 

	public OrderDto() {
	}
	
	public OrderDto(String orderNum, String orderInsDate, Long userId, String prearrangeTime, String orderNotes, Long orderDiscount) {
		this.orderNum = orderNum;
		this.orderInsDate = orderInsDate;
		this.orderWxUser = userId;
		this.orderPrearrangeTime = prearrangeTime;
		this.orderNotes = orderNotes;
		this.orderDiscount = orderDiscount;
	}

	public OrderDto(Long orderId) {
		this.orderId = orderId;
	}
	

	public OrderDto(Long orderId, Integer orderState , Integer orderPayState) {
		 this.orderId = orderId;
		 this.orderState = orderState;
		 this.orderPayState = orderPayState;
	}
	//用于业务员确认修改订单状态和支付状态
	public OrderDto(Long orderId, Integer orderState , Integer orderPayState,Float allPay,Float carriage, Float carryFee, Float packFee,Integer isCarry,Integer isPack) {
		 this.orderId = orderId;
		 this.orderState = orderState;
		 this.orderPayState = orderPayState;
		 this.orderMovePay = carryFee;
		 this.orderPackPay = packFee;
		 this.orderAllPay = allPay;
		 this.orderCarriage =  carriage;
		 this.orderToCarry = isCarry;
		 this.orderToPack = isPack;
	}

	public OwnerDto getReciver() {
		return reciver;
	}

	public void setReciver(OwnerDto reciver) {
		this.reciver = reciver;
	}

	public OwnerDto getSender() {
		return sender;
	}

	public void setSender(OwnerDto sender) {
		this.sender = sender;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public List<DriverDto> getDrivers() {
		return drivers;
	}

	public void setDrivers(List<DriverDto> drivers) {
		this.drivers = drivers;
	}

	public List<TruckDto> getTrucks() {
		return trucks;
	}

	public void setTrucks(List<TruckDto> trucks) {
		this.trucks = trucks;
	}

	public Long getOrderId() {
		return orderId;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	public String getOrderNum() {
		return orderNum;
	}

	public void setOrderNum(String orderNum) {
		this.orderNum = orderNum;
	}

	public String getOrderNotes() {
		return orderNotes;
	}

	public void setOrderNotes(String orderNotes) {
		this.orderNotes = orderNotes;
	}

	public Long getOrderSender() {
		return orderSender;
	}

	public void setOrderSender(Long orderSender) {
		this.orderSender = orderSender;
	}

	public Long getOrderReciver() {
		return orderReciver;
	}

	public void setOrderReciver(Long orderReciver) {
		this.orderReciver = orderReciver;
	}

	public Integer getOrderRestate() {
		return orderRestate;
	}

	public void setOrderRestate(Integer orderRestate) {
		this.orderRestate = orderRestate;
	}

	public Integer getOrderState() {
		return orderState;
	}

	public void setOrderState(Integer orderState) {
		this.orderState = orderState;
	}

	public Integer getOrderPayState() {
		return orderPayState;
	}

	public void setOrderPayState(Integer orderPayState) {
		this.orderPayState = orderPayState;
	}

	public Long getOrderWxUser() {
		return orderWxUser;
	}

	public void setOrderWxUser(Long orderWxUser) {
		this.orderWxUser = orderWxUser;
	}

	public String getOrderInsDate() {
		return orderInsDate;
	}

	public void setOrderInsDate(String orderInsDate) {
		this.orderInsDate = orderInsDate;
	}

	public String getOrderUpdateDate() {
		return orderUpdateDate;
	}

	public void setOrderUpdateDate(String orderUpdateDate) {
		this.orderUpdateDate = orderUpdateDate;
	}

	public Long getOrderQuit() {
		return orderQuit;
	}

	public void setOrderQuit(Long orderQuit) {
		this.orderQuit = orderQuit;
	}

	public Integer getOrderToCarry() {
		return orderToCarry;
	}

	public void setOrderToCarry(Integer orderToCarry) {
		this.orderToCarry = orderToCarry;
	}

	public Integer getOrderToPack() {
		return orderToPack;
	}

	public void setOrderToPack(Integer orderToPack) {
		this.orderToPack = orderToPack;
	}

	public Integer getOrderFloorNum() {
		return orderFloorNum;
	}

	public void setOrderFloorNum(Integer orderFloorNum) {
		this.orderFloorNum = orderFloorNum;
	}

	public Integer getOrderBoxNum() {
		return orderBoxNum;
	}

	public void setOrderBoxNum(Integer orderBoxNum) {
		this.orderBoxNum = orderBoxNum;
	}

	public Integer getOrderIsMove() {
		return orderIsMove;
	}

	public void setOrderIsMove(Integer orderIsMove) {
		this.orderIsMove = orderIsMove;
	}

	public Integer getOrderToInvoice() {
		return orderToInvoice;
	}

	public void setOrderToInvoice(Integer orderToInvoice) {
		this.orderToInvoice = orderToInvoice;
	}

	public String getOrderPayTime() {
		return orderPayTime;
	}

	public void setOrderPayTime(String orderPayTime) {
		this.orderPayTime = orderPayTime;
	}

	public Integer getOrderPayWay() {
		return orderPayWay;
	}

	public void setOrderPayWay(Integer orderPayWay) {
		this.orderPayWay = orderPayWay;
	}

	public Float getOrderAllPay() {
		return orderAllPay;
	}

	public void setOrderAllPay(Float orderAllPay) {
		this.orderAllPay = orderAllPay;
	}

	public Float getOrderPackPay() {
		return orderPackPay;
	}

	public void setOrderPackPay(Float orderPackPay) {
		this.orderPackPay = orderPackPay;
	}

	public Float getOrderCod() {
		return orderCod;
	}

	public void setOrderCod(Float orderCod) {
		this.orderCod = orderCod;
	}

	public Float getOrderMovePay() {
		return orderMovePay;
	}

	public void setOrderMovePay(Float orderMovePay) {
		this.orderMovePay = orderMovePay;
	}

	public Integer getOrderIsDelete() {
		return orderIsDelete;
	}

	public void setOrderIsDelete(Integer orderIsDelete) {
		this.orderIsDelete = orderIsDelete;
	}

	public Long getOrderDriver() {
		return orderDriver;
	}

	public void setOrderDriver(Long orderDriver) {
		this.orderDriver = orderDriver;
	}

	public Long getOrderTruck() {
		return orderTruck;
	}

	public void setOrderTruck(Long orderTruck) {
		this.orderTruck = orderTruck;
	}

	public String getOrderTruckType() {
		return orderTruckType;
	}

	public void setOrderTruckType(String orderTruckType) {
		this.orderTruckType = orderTruckType;
	}

	@Override
	public String toString() {
		return "OrderDto [orderId=" + orderId + ", orderNum=" + orderNum + ", orderNotes=" + orderNotes
				+ ", orderSender=" + orderSender + ", orderReciver=" + orderReciver + ", orderRestate=" + orderRestate
				+ ", orderState=" + orderState + ", orderPayState=" + orderPayState + ", orderWxUser=" + orderWxUser
				+ ", orderInsDate=" + orderInsDate + ", orderUpdateDate=" + orderUpdateDate + ", orderQuit=" + orderQuit
				+ ", orderToCarry=" + orderToCarry + ", orderToPack=" + orderToPack + ", orderFloorNum=" + orderFloorNum
				+ ", orderBoxNum=" + orderBoxNum + ", orderIsMove=" + orderIsMove + ", orderToInvoice=" + orderToInvoice
				+ ", orderPayTime=" + orderPayTime + ", orderPayWay=" + orderPayWay + ", orderAllPay=" + orderAllPay
				+ ", orderPackPay=" + orderPackPay + ", orderCod=" + orderCod + ", orderMovePay=" + orderMovePay
				+ ", orderIsDelete=" + orderIsDelete + ", orderDriver=" + orderDriver + ", orderTruck=" + orderTruck
				+ ", orderTruckType=" + orderTruckType + ", reciver=" + reciver + ", sender=" + sender + ", openId="
				+ openId + ", drivers=" + drivers + ", trucks=" + trucks + "]";
	}

	public OrderDto cargo(Long cargoId) {
		this.orderCargo = cargoId;
		return this;
	}

	public OrderDto insTime() {
		this.orderInsDate = DateUtils.getCurDttStr();
		return this;
	}

	public OrderDto truckType(String truckType) {
		this.orderTruckType = truckType;
		return this;
	}

	public OrderDto no(String orderNum) {
		if(StringUtils.isEmpty(orderNum)){
			this.orderNum = TokenUtils.getNo(GenerateNumConstants.ORDER);
		}else{
			this.orderNum = orderNum;
		}
		this.orderNum = TokenUtils.getNo(GenerateNumConstants.ORDER);
		return this;
	}

	public OrderDto allPay(Float price) {
		if (null != price) {
			this.orderAllPay = price;
		}
		return this;
	}

	public OrderDto wxUser(Long id) {
		this.orderWxUser = id;
		return this;
	}

	public OrderDto openId(String openId) {
		this.openId = openId;
		return this;
	}

	public OrderDto senderId(Long senderId) {
		this.orderSender = senderId;
		return this;
	}
	public OrderDto reciverId(Long reciverId) {
		this.orderReciver = reciverId;
		return this;
	}

	public OrderDto carriage(Float orderCarriage) {
		this.orderCarriage = orderCarriage ;
		return  this;
	}

	public OrderDto requireTruck(Integer orderDriverRequire) {
		this.orderDriverRequire = orderDriverRequire;
		return this;
	}

	public OrderDto alreadTruck(Integer orderDriverAleady) {
		 this.orderDriverAlready = orderDriverAleady;
		return this;
	}

	public OrderDto IsMove(Integer isMove) {
		this.orderIsMove = isMove;
		return this;
	}

	public OrderDto payState(Integer orderPayState) {
		this.orderPayState = orderPayState;
		return this;
	}

	public OrderDto payWay(Integer payway) {
		this.orderPayWay = payway;
		return this;
	}


}
